<script>
function back(){
    window.location.href = <?php echo $_SERVER['HTTP_REFERER']; ?>;
}
</script>
<div style="text-align: center;">
<?php

/**
 * @author Martin Pernica
 * @copyright 2008
 */
if(!empty($_GET['id'])){
	
	if($_POST['delete'] == Lang::getBack('com_user', 'delete_buttom')){
		$query = $db->query("DELETE FROM {prefix}users WHERE id = '".intval($_GET['id'])."'");
        $log->write(8, 'com_user', 'NOW()', 'User deleted account '. $_SESSION['temp']['com_user_delete_nick'], $_SESSION['id']);
		
        messageBox( Lang::getBack('com_user', 'delete_done') );
        
		echo '<meta http-equiv="refresh" content="2;url=index.php?p=components&name=user">';
        
	}else{
	    $user = User::getDisplayName($_GET['id']);
        $_SESSION['temp']['com_user_delete_nick'] = $user;
	    echo '<h2>'.Lang::getBack('com_user', 'delete_alert', $user).'</h2>';
		echo '<form action="'.$_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'].'" method="post"><br />';
		echo '<input type="submit" name="delete" value="'.Lang::getBack('com_user', 'delete_buttom').'" />&nbsp;&nbsp;&nbsp;<input type="button" value="'.Lang::getBackGlobal('back').'" onclick="back()" /></form>';
	}
}
?>
</div>